<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //   \b 匹配单词的开始或者结束
        //   \g 匹配所有
        var reg = /\bis\b/g
        // 把所有 is 变成 IS
        var str = 'he is a boy, this is a dog. where is she?'.replace(reg, 'IS')
        console.log(str)
    </script>
</body>
</html>